# Contributor: rubicon <rubicon@mailo.com>
# Maintainer:
pkgname=ocaml-uucp
_pkgname=uucp
pkgver=14.0.0
pkgrel=0
pkgdesc="Unicode character properties for OCaml"
url="https://erratique.ch/software/uucp"
# limited by riscv64: ocaml, ppc64le: ocaml-uunf
arch="all !riscv64 !ppc64le"
license="ISC"
depends="ocaml-runtime"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="
	ocaml
	ocaml-compiler-libs
	ocaml-findlib
	ocamlbuild
	ocaml-topkg
	ocaml-uucd-dev
	ocaml-uunf-dev
	ocaml-uutf-dev
	ocaml-cmdliner-dev
	cmd:opam-installer
	"
options="!check"  # no tests provided
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.bz2::https://erratique.ch/software/uucp/releases/uucp-$pkgver.tbz"
builddir="$srcdir/$_pkgname-$pkgver"
_ocamldir=usr/lib/ocaml

# 32-bit archs
case "$CARCH" in
	arm*|x86) options="$options textrels" ;;
esac

build() {
	ocaml pkg/pkg.ml build \
		--with-uutf true \
		--with-uunf true \
		--with-cmdliner true
}

package() {
	opam-installer -i \
		--prefix="$pkgdir/usr" \
		--libdir="$pkgdir/$_ocamldir" \
		--docdir="$builddir/.omit" \
		$_pkgname.install
}

dev() {
	default_dev

	cd "$pkgdir"

	local path; for path in $(find $_ocamldir \( \
			-name '*.cmt' -o \
			-name '*.cmti' -o \
			-name '*.cmx' -o \
			-name '*.cmxa' -o \
			-name '*.ml' -o \
			-name '*.mli' \
		\))
	do
		amove "$path"
	done
}

sha512sums="
2d0224aed5d5accbb121624898f08598e8c74a2415942f159a54221c0cdac62ed64fc70a039c833e50110cefce77754ada9ac2d58f79a6fc9331135326fe6899  ocaml-uucp-14.0.0.tar.bz2
"
